<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>编辑添加的一行产品数据</title>
</head>
<body>
<script>
    $(function () {

        $("#editAddLinePro-close").linkbutton({onClick:function () {
                $("#pdg-add-editLine-dialog").dialog("close");
            }});
        $("#hut-ppmoney").textbox({
            onChange:function (newValue) {
                $("#hut-ppcost").textbox('setValue',newValue*$("#hut-ppcount").textbox("getValue"));
            }
        });
        $("#hut-ppcount").textbox({
            onChange:function (newValue) {
                $("#hut-ppcost").textbox('setValue',newValue*$("#hut-ppmoney").textbox("getValue"));
            }
        });
        $("#editAddLinePro-save").linkbutton({
            onClick:function () {
                if(!isNaN($("#hut-ppcost").textbox('getValue'))){
                    var selectRow =   $("#pdg-add").datagrid("getSelected");
                    selectRow['ppmoney']=$("#hut-ppmoney").textbox("getValue");
                    selectRow['ppcount']=$("#hut-ppcount").textbox("getValue");
                    selectRow['ppcost'] = $("#hut-ppcost").textbox("getValue");
                    $("#pdg-add").datagrid("clearChecked");
                    var nowData = $.parseJSON(JSON.stringify($("#pdg-add").datagrid("getData")));
                    $('#pdg-add').datagrid('loadData', nowData);
                    // $("#pdg-add").datagrid("reload");
                    $("#pdg-add-editLine-dialog").dialog("close");
                }else {
                    $.messager.alert("Failed","不可设置非法数值！","warning");
                }
            }
        });
    });
</script>
<div class="form-div">
    <form id="editAddLinePro-form" action="" method="">
        <div class="div-title-hut"> --------------------------------<span class="span-title">编辑采购商品明细信息</span>---------------------------</div>
        <div class="ddt">
            <input id="hut-ppmoney"  name="ppmoney" class="easyui-textbox" data-options="label:'采购价格',required:true,width:300">
        </div>
        <div class="ddt">
            <input id="hut-ppcount" name="ppcount" class="easyui-textbox" data-options="label:'采购总数',required:true,width:300">
        </div>
        <div class="ddt">
            <input id="hut-ppcost" name="ppcost" class="easyui-textbox" data-options="label:'采购总价',required:true,editable:false,width:300">
        </div>
        <div class="btn" style="text-align:center;margin-top:10px;">
            <!--此按钮可根据自己业务自行修改或删除-->
            <a id="editAddLinePro-save" class="easyui-linkbutton " data-options="iconCls:'icon-ok2'">设置</a><div style="width: 20px;display: inline-block"></div>
            <a id="editAddLinePro-close" class="easyui-linkbutton" data-options="iconCls:'icon-cancel2'">取消</a>
        </div>
    </form>
</div>
</body>
</html>
